﻿using System;
using System.Collections.Generic;

namespace Combinations
{
    public static class Combinations
    {
        private static List<string> returnResults = new List<string>();
        private static int maxWordLength;

        public static string[] GetCombinations(string word)
        {
            maxWordLength = word.Length;
            GetWord(word, "");
            return returnResults.ToArray();
        }

        private static void GetWord(string word, string prefix)
        {
            if (prefix.Length == maxWordLength)
                returnResults.Add(prefix);
            else
            {
                for ( int i = 0; i < maxWordLength; i++ )
                    GetWord(word, prefix + word[i]);
            }
        }
    }
}
